/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.breeze.dom;

import java.util.logging.Level;
import java.util.logging.Logger;
import ognl.Ognl;
import ognl.OgnlException;
import org.w3c.dom.Node;

/**
 *
 * @author huateng
 */
public  class DefaultTag implements Tag{
    protected   Object root;
    protected Node node;
   
    public DefaultTag(Node n,Object r){
        this.root=r;
        this.node=n;
    }
    
    public DefaultTag(Node n){
        this.node=n;
    }
    
    protected Object getValue(String expr){
        try {
            return Ognl.getValue(expr, getRoot());
        } catch (OgnlException ex) {
            Logger.getLogger(DefaultTag.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    /**
     * @return the root
     */
    public Object getRoot() {
        return root;
    }

    /**
     * @param root the root to set
     */
    public void setRoot(Object root) {
        this.root = root;
    }

    /**
     * @return the node
     */
    public Node getNode() {
        return node;
    }

    /**
     * @param node the node to set
     */
    public void setNode(Node node) {
        this.node = node;
    }

    public String display() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
